package com.mercury.pattern._09_facade;

/**
 * 利用外观模式组合各种仪器
 */
public class HomeTheatre {
    //将子系统组合到外观中
    DVDPlayer dvdPlayer;
    Projector projector;

    public HomeTheatre() {
        this.dvdPlayer = DVDPlayer.getInstance();
        this.projector = Projector.getInstance();
    }

    /**
     * 将各子系统中的方法，组合成几个通用的方法
     */
    public void on(){
        projector.on();
        dvdPlayer.on();
    }

    public void play(){
        dvdPlayer.play();
    }

    public void off(){
        projector.off();
        dvdPlayer.off();
    }
}